/*
	GameMode Core
	(c) 2012
	by skkf
*/

#tryinclude <a_samp>
#tryinclude <a_mysql>

#define MYSQL_HOST ""
#define MYSQL_USER ""
#define MYSQL_PASS ""
#define MYSQL_DB   ""

new hMySQL;
public OnGameModeInit()
{
	hMySQL = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS);
	if(mysql_ping() == (-1)) print("MySQL Dead!"); SendRconCommand("exit");
	
	mysql_query("SELECT * FROM `useracc`");
	mysql_store_result();
	new users = mysql_num_rows();
	mysql_free_result();
	
	mysql_query("SELECT * FROM `wg_arenas`");
	mysql_store_result();
	new arenas_wg = mysql_num_rows();
	mysql_free_result();
	
	mysql_query("SELECT * FROM `ctf_arenas`");
	mysql_store_result();
	new arenas_ctf = mysql_num_rows();
	mysql_free_result();
	
	mysql_query("SELECT * FROM `race_arenas`");
	mysql_store_result();
	new arenas_race = mysql_num_rows();
	mysql_free_result();
	
	mysql_query("SELECT * FROM `derby_arenas`");
	mysql_store_result();
	new arenas_derby = mysql_num_rows();
	mysql_free_result();
	
	print("Uruchamianie SKKF-DM");
	printf("Kont graczy: %d", users);
	printf("Aren WG: %d", arenas_wg);
	printf("Aren CTF: %d", arenas_ctf);
	printf("Aren Race: %d", arenas_race);
	printf("Aren Derby: %d", arenas_derby);
	return 1;
}

public OnGameModeExit()
{
	mysql_close(hMySQL);
	return 1;
}
